<?php

/*
 * Copyright 2008 the original author or authors.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#namespace tehframework;

#use tehframework\factory\ObjectFactoryAware;
#use tehframework\factory\ObjectFactory;

class FakeObject implements ObjectFactoryAware
{
	/**
	 * @var EventHandler
	 */
	public $event1;
	
	/**
	 * @var EventHandler
	 */
	public $event2;
	
	/**
	 * @var mixed
	 */
	private $arg1;
	
	/**
	 * @var mixed
	 */
	public $field1;
	
	/**
	 * @var mixed
	 */
	private $prop1;
	
	/**
	 * @var mixed
	 */
	private $prop2;
	
	/**
	 * @var bool
	 */
	private $wasObjectFactorySet = false;
	
	/**
	 * @param  mixed $arg1
	 */
	public function __construct($arg1 = null)
	{
		$this->event1 = new EventHandler();
		$this->arg1   = $arg1;
	}
	
	/**
	 * @return string
	 */
	public function __toString()
	{
		return get_class();
	}
	
	/**
	 * @param  ObjectFactory $objectFactory
	 */
	public function setObjectFactory(ObjectFactory $objectFactory)
	{
		$this->wasObjectFactorySet = true;
	}
	
	/**
	 * @return bool
	 */
	public function wasObjectFactorySet()
	{
		return $this->wasObjectFactorySet;
	}
	
	/**
	 * @return mixed
	 */
	public function getArg1()
	{
		return $this->arg1;
	}
	
	/**
	 * @return mixed
	 */
	public function getProp1()
	{
		return $this->prop1;
	}
	
	/**
	 * @param  mixed $prop1
	 * @return FakeObject
	 */
	public function setProp1($prop1)
	{
		$this->prop1 = $prop1;
		
		return $this;
	}
	
	/**
	 * @return mixed
	 */
	public function getProp2()
	{
		return $this->prop2;
	}
	
	/**
	 * @param  mixed $prop2
	 * @return FakeObject
	 */
	public function setProp2($prop2)
	{
		$this->prop2 = $prop2;
		
		return $this;
	}
	
	/**
	 * @param  mixed $something
	 */
	public function saveSomething($something)
	{
		$this->something = $something;
	}
	
	/**
	 * @return mixed
	 */
	public function whatWasSaved()
	{
		return $this->something;
	}
	
	/**
	 * @param  mixed $prop1
	 */
	protected function setProtectedProp($prop1)
	{
		$this->prop1 = $prop1;
	}
	
	/**
	 * @param  mixed $prop2
	 */
	protected function setPrivateProp($prop2)
	{
		$this->prop2 = $prop2;
	}
}